package view.component.dialog
{
	import core.Language;
	
	import framework.view.components.button.ButtonProxy;
	
	import view.component.window.WindowProxy;
	
	public class ConfirmDialogProxy extends WindowProxy
	{
		public function ConfirmDialogProxy()
		{
			super();
		}
		
		override protected function get proxyMapping():Array
		{
			return [
				{skin:"titleTF" , text:Language.getText("@system_tip_desc")},
				{skin:"yesBtn" , classRef:ButtonProxy , text:Language.getText("@yes_btn_label") , onClick:onYesClick , id:"yesBtn"},
				{skin:"noBtn" , classRef:ButtonProxy , text:Language.getText("@cancel_btn_label") , onClick:onNoClick , id:"noBtn"}
			];
		}
		
		protected function get yesBtn():ButtonProxy
		{
			return proxys["yesBtn"];
		}
		
		protected function get noBtn():ButtonProxy
		{
			return proxys["noBtn"];
		}
		
		protected function onYesClick():void
		{
			if(_onYesCallBack != null) _onYesCallBack();
			this.close();
		}
		
		protected function onNoClick():void
		{
			if(_onNoCallBack != null) _onNoCallBack();
			this.close();
		}
		
		override public function dispose():void
		{
			_onNoCallBack = null;
			_onYesCallBack = null;
			super.dispose();
		}
		
		public function set yesBtnTxt(value:String):void
		{
			yesBtn.text = value;
		}
		
		public function set noBtnTxt(value:String):void
		{
			noBtn.text = value;
		}
        
        protected var _data:*;
        
        public function get data():*
        {
            return _data;
        }
        
        public function set data(value:*):void
        {
            _data = value;
            
            if (data is String || data is XML || data is XMLList)
            {
                skin.contentTF.text = data;
            }
        }
		
		public function set titleTxt(value:String):void
		{
			skin.titleTF.text = value;
		}
		
		private var _onYesCallBack:Function;
		
		public function set onYesCallBack(value:Function):void
		{
			_onYesCallBack = value;
		}
		
		private var _onNoCallBack:Function;
		
		public function set onNoCallBack(value:Function):void
		{
			_onNoCallBack = value;
		}

	}
}